<div class="fm-content">
  <div class="title">
    <i nz-icon [type]="'desktop'"></i>
    &nbsp;&nbsp;Web端构建
  </div>
  <div class="work">
    <div class="top">
      <input nz-input placeholder="名称" class="fm-input first-input" [(ngModel)]="fs.queryObject['display:like']" />
      <nz-button-group>
        <button nz-button nzType="primary" (click)="fs.loadData(true)">查询</button>
        <button nz-button (click)="fs.resetQueryObject() && fs.loadData(true)">重置</button>
      </nz-button-group>
    </div>

    <div class="work-content">
      <div class="table">
        <nz-table nzSize="middle" nzShowSizeChanger [nzShowPagination]="false" [nzFrontPagination]="false"
          [nzData]="fs.datas" [nzLoading]="fs.isLoading || fs.isDeleing">
          <thead>
            <tr>
              <th nzWidth="35%">名称</th>
              <th nzWidth="15%">类型</th>
              <th nzWidth="50%">操作</th>
            </tr>
          </thead>
          <tbody>
            <ng-template ngFor let-data [ngForOf]="fs.datas">
              <ng-template ngFor let-item [ngForOf]="fs.expandDataCache[data.id]">
                <tr *ngIf="(item.parent&&item.parent.expand)||!(item.parent)">
                  <td [nzIndentSize]="item.level*20" [nzShowExpand]="!item.leaf" [(nzExpand)]="item.expand"
                    (nzExpandChange)="fs.collapse(item,$event)">
                    {{item.display}}({{item.id}})
                  </td>
                  <td>{{item.directoryTypeName}}</td>
                  <td>
                    <a *ngIf="item.directoryType=='3'" class="form-button" (click)="start(item, 1)">普通表单</a>
                    <a *ngIf="item.directoryType=='3'" class="form-button" (click)="start(item, 2)">树型表单</a>
                    <a *ngIf="item.directoryType=='3'" class="form-button" (click)="start(item, 3)">侧栏普通</a>
                    <a *ngIf="item.directoryType=='3'" class="form-button" (click)="start(item, 4)">侧栏树型</a>
                    <a *ngIf="item.directoryType=='3'" class="form-button" (click)="start(item, 5)">大弹窗表单</a>
                    <a *ngIf="item.directoryType=='3'" class="form-button" (click)="start(item, 6)">流程表单</a>
                  </td>
                </tr>
              </ng-template>
            </ng-template>
          </tbody>
        </nz-table>
      </div>
    </div>

    <nz-modal nzWidth='830' nzTitle="构建参数" [nzMaskClosable]='false' [nzFooter]="null" [(nzVisible)]="bfs.isEditVisible"
      (nzOnCancel)="bfs.closeEdit()">
      <form nz-form [nzLayout]="'inline'">
        <div nz-row [nzGutter]="24">
          <div nz-col [nzSpan]="12">
            <nz-form-item>
              <nz-form-label class="form-label">元数据</nz-form-label>
              <nz-form-control class="form-control">
                {{bfs.er.mateID}}
              </nz-form-control>
            </nz-form-item>
          </div>
          <div nz-col [nzSpan]="12">
            <nz-form-item>
              <nz-form-label nzRequired class="form-label">工程名称</nz-form-label>
              <nz-form-control class="form-control" [nzValidateStatus]="proName.invalid?'error':'success'"
                nzHasFeedback>
                <input nz-input required [(ngModel)]="proName" name="proName">
              </nz-form-control>
            </nz-form-item>
          </div>
        </div>
        <div nz-row [nzGutter]="24">
          <div nz-col [nzSpan]="12">
            <nz-form-item>
              <nz-form-label nzRequired class="form-label">文件名称</nz-form-label>
              <nz-form-control class="form-control" [nzValidateStatus]="fileName.invalid?'error':'success'"
                nzHasFeedback>
                <input nz-input required [(ngModel)]="bfs.er.fileName" name="fileName" #fileName="ngModel">
              </nz-form-control>
            </nz-form-item>
          </div>
          <div nz-col [nzSpan]="12">
            <nz-form-item>
              <nz-form-label nzRequired class="form-label">表单名称</nz-form-label>
              <nz-form-control class="form-control" [nzValidateStatus]="formName.invalid?'error':'success'"
                nzHasFeedback>
                <input nz-input required [(ngModel)]="bfs.er.formName" name="formName" #formName="ngModel">
              </nz-form-control>
            </nz-form-item>
          </div>
        </div>
        <div nz-row [nzGutter]="24">
          <div nz-col [nzSpan]="12">
            <nz-form-item>
              <nz-form-label nzRequired class="form-label">表单别名</nz-form-label>
              <nz-form-control class="form-control" [nzValidateStatus]="formAliseName.invalid?'error':'success'"
                nzHasFeedback>
                <input nz-input required [(ngModel)]="bfs.er.formAliseName" name="formAliseName"
                  #formAliseName="ngModel">
              </nz-form-control>
            </nz-form-item>
          </div>
          <div nz-col [nzSpan]="12">
            <nz-form-item>
              <nz-form-label nzRequired class="form-label">主键</nz-form-label>
              <nz-form-control class="form-control" [nzValidateStatus]="keyFiled.invalid?'error':'success'"
                nzHasFeedback>
                <input nz-input required [(ngModel)]="bfs.er.keyFiled" name="keyFiled" #keyFiled="ngModel">
              </nz-form-control>
            </nz-form-item>
          </div>
        </div>
        <div nz-row [nzGutter]="24">
          <div nz-col [nzSpan]="12">
            <nz-form-item>
              <nz-form-label nzRequired class="form-label">排序键</nz-form-label>
              <nz-form-control class="form-control" [nzValidateStatus]="order.invalid?'error':'success'" nzHasFeedback>
                <input nz-input required [(ngModel)]="bfs.er.order" name="order" #order="ngModel">
              </nz-form-control>
            </nz-form-item>
          </div>
        </div>

        <div nz-row [nzGutter]="24">
          <div nz-col [nzSpan]="24" class="form-button-align">
            <button nz-button nzType="default" (click)="bfs.closeEdit()" class="form-button">取消</button>
            <button nz-button nzType="primary"
              [disabled]='proName.invalid || fileName.invalid || formName.invalid || formAliseName.invalid || keyFiled.invalid || order.invalid'
              (click)="build()" [nzLoading]="bfs.isSaveing">构建</button>
          </div>
        </div>
      </form>
    </nz-modal>
  </div>
</div>